#!/bin/bash

if command -v apt &> /dev/null; then
    PKG_MANAGER="apt"
elif command -v yum &> /dev/null; then
    PKG_MANAGER="yum"
elif command -v dnf &> /dev/null; then
    PKG_MANAGER="dnf"
else
    echo "不支持的包管理器"
    exit 1
fi

echo '正在安装部署工具'
$PKG_MANAGER update &> /dev/null
$PKG_MANAGER install -y wget ansible &> /dev/null

clear

echo '正在安装Docker和WordPress'
cp docker-compose.yaml /tmp/docker-compose.yaml
ansible-playbook init/install.yaml

echo '部署完成，请通过docker ps查看运行状态'
echo '请根据实际情况，修改nginx.conf配置文件'